package com.nononsenseapps.feeder.net.obs.model

import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class SampleList(val items:Array<Sample>) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as SampleList

        if (!items.contentEquals(other.items)) return false

        return true
    }

    override fun hashCode(): Int {
        return items.contentHashCode()
    }
}

@JsonClass(generateAdapter = true)
data class Sample(val filename:String,val score:Number,val matches:Array<SampleItem>) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as Sample

        if (filename != other.filename) return false
        if (score != other.score) return false
        if (!matches.contentEquals(other.matches)) return false

        return true
    }

    override fun hashCode(): Int {
        var result = filename.hashCode()
        result = 31 * result + score.hashCode()
        result = 31 * result + matches.contentHashCode()
        return result
    }
}

@JsonClass(generateAdapter = true)
data class SampleItem(val match:SampleMatch,val context:String)

@JsonClass(generateAdapter = true)
data class SampleMatch(val start:Number,val end:Number)